//
//  KAReport.swift
//  kano
//
//  Created by Frank on 2024/10/8.
//

import Foundation


class KAReport {
    
    static func ka_reportWith(type: KAReportType) {
        ka_reportWith(type: type, data: [:])
    }
    
    static func ka_reportWith(type: KAReportType, data: Dictionary<String, Any>) {
        switch type {
        case .device:
            let device = KADevInfo()
            NetService.ka_reportWith(param: device.kj.JSONObject(), handler: nil)
        case .loaction:
            if KALocationManager.shared.status == .authorizedAlways || KALocationManager.shared.status == .authorizedWhenInUse {
                let location = KALocationInfo()
                NetService.ka_reportWith(param: location.kj.JSONObject(), handler: nil)
            }
        case .permissionLoc:
            let device = KAPermitInfo(type: . permissionLoc, permit: data["permit"] as! Bool)
            NetService.ka_reportWith(param: device.kj.JSONObject(), handler: nil)
            
        case .subChannel:
            NetService.ka_reportSubChannel()
            
        case .tf: fallthrough
        case .btn: fallthrough
        case .page:
            NetService.ka_reportWith(param: data, handler: nil)
            
        case .log:
            NetService.ka_reportWith(param: data, handler: nil)
        default:
            break
        }
    }
}
